Engine

fun Engine(renderingMode: RenderingMode, configuration: OptionsDsl.() -> Unit = { /* Matches defaults. */ }): Engine
fun Engine(renderingMode: RenderingMode, configuration: OptionsDsl.() -> Unit = { /* Matches defaults. */ }): Engine

Creates a new instance of Engine with the given renderingMode and configuration.

Please note, JxBrowserLicense is needed to create an engine. It can be passed implicitly with a VM option or explicitly during the instance creation. In the latter scenario, a license is passed as a part of engine's configuration.

In the simplest case, when a license is passed as a VM option, only RenderingMode is needed to create a new Engine:

import com.teamdev.jxbrowser.engine.RenderingMode.HARDWARE_ACCELERATED
// ...
val engine = Engine(HARDWARE_ACCELERATED)

The custom options can be passed with the given configuration block:

import com.teamdev.jxbrowser.engine.RenderingMode.HARDWARE_ACCELERATED
// ...
val engine = Engine(HARDWARE_ACCELERATED) {
license = JxBrowserLicense(licenseKey)
userDataDir = chooseUserDataDir()
}

EngineOptions can be created separately from the Engine itself. This allows re-using of the same options to create multiple engine instances.

An example of engine creation with a standalone options:

import com.teamdev.jxbrowser.dsl.engine.EngineOptions
// ...
val options = EngineOptions {
license = JxBrowserLicense(licenseKey)
userDataDir = chooseUserDataDir()
}
val engine = Engine(options)

Since

8.0.0


fun Engine(options: EngineOptions): Engine
fun Engine(options: EngineOptions): Engine

Creates a new instance of Engine with the given options.

Since

8.0.0